// router/routes.ts
import { RouteRecordRaw } from 'vue-router';
import Layout from '@/layout/index.vue';

export const constantRoutes: RouteRecordRaw[] = [
  {
    path: '/:pathMatch(.*)*',
    component: () => import('@/views/error/404.vue'),
    hidden: true
  },
  {
    path: '/401',
    component: () => import('@/views/error/401.vue'),
    hidden: true
  },
  {
    path: '/login',
    component: () => import('@/views/Login.vue')
  },
  {
    path: '/register',
    component: () => import('@/views/Register.vue')
  },
  {
    path: '',
    redirect: 'social',
    component: Layout,
    children: [
      {
        path: 'index',
        component: () => import('@/views/index.vue'),
        name: '主页面'
      },
      {
        path: '/angling',
        component: () => import('@/views/angling/index.vue'),
        name: '钓场页面'
      },
      {
        path: '/angling/detail/:fishSiteId',
        component: () => import('@/views/angling/details.vue'),
        name: '钓场详情',
        props(route) {
        },
      },
      {
        path: '/shopping',
        component: () => import('@/views/shopping/index.vue'),
        name: '商城页'
      },
      {
        path: '/shopping/detail',
        component: () => import('@/views/shopping/details.vue'),
        name: '商城页详细'
      },
      {
        path: '/social',
        component: () => import('@/views/social/index.vue'),
        name: '社交广场'
      },
      {
        path: '/social/hot',
        component: () => import('@/views/social/hotPosts.vue'),
        name: '热门帖子'
      },
      {
        path: '/social/detail',
        component: () => import('@/views/social/details.vue'),
        name: '帖子详细',
      },
      {
        path: '/user',
        component: () => import('@/views/user/index.vue'),
        name: '用户中心'
      },
      {
        path: '/user/address',
        component: () => import('@/views/user/address.vue'),
        name: '用户地址管理'
      },
      {
        path: '/user/control/home',
        component: () => import('@/views/user/ControlHome.vue'),
        name: '个人主页'
      },
      {
        path: '/user/message',
        component: () => import('@/views/user/message.vue'),
        name: '用户消息通知'
      },
      {
        path: '/user/postEdit',
        component: () => import('@/views/user/components/PostEdit.vue'),
        name: '帖子编辑'
      },
      {
        path: '/user/change-password',
        component: () => import('@/views/user/changePassword.vue'),
      },
      {
        path: '/fishKnowledge',
        component: () => import('@/views/fishKnowledge/index.vue'),
        // name: '钓鱼小知识'
      },
      {
        path: '/chat',
        name: 'AiChat',
        component: () => import('@/views/chat/AiChat.vue'),
        meta: {
          title: 'AI助手',
          requiresAuth: true
        }
      }
    ]
  },
];
